import { axiosInstance } from '../utils/request'

//获取角色数据
export const getAllRoleApi = (data) => {
    return axiosInstance.get(`/role?${data}`, { headers: { 'Authentication': localStorage.token } })
}

//新增角色
export const addRoleApi = (data) => {
    return axiosInstance.post('/role', data, { headers: { 'Authentication': localStorage.token } })
}

//根据 ID 删除角色
export const delByIdApi = (data) => {
    return axiosInstance.delete(`/role/${data}`, { headers: { 'Authentication': localStorage.token } })
}

//角色对应菜单
export const getOneRole = (data) => {
    return axiosInstance.get(`/role/menu/${data}`, { headers: { 'Authentication': localStorage.token } })
}

//修改角色信息
export const changeOneRole = (data) => {
    return axiosInstance.put('/role', data, { headers: { 'Authentication': localStorage.token } })
}